#ifndef SOUNDPLAYER_H
#define SOUNDPLAYER_H
/*
 * SoundPlayer.h
 * ---------------------------------------------------------------
 * Project     : SoundSeeker
 * Version     : 1.0
 
 * Category    : sound player
 * Created by  : Florian Loferer, 09/2010
 * ---------------------------------------------------------------
 * Description : 
 *		Implementation of a simple sound player based on the 
 *		Phonon front end. 
 *		On OS X, QuickTime is used as backend for playback functions.
 *		Class uses a Singleton pattern
 * ---------------------------------------------------------------
 * Copyright (C) 2010-2011, Florian Loferer
 *
 * This file is part of the SoundSeeker audio sample library administration tool.
 * For conditions of distribution and use, see the accompanying README file.
 */

#include <phonon/MediaObject>
#include <phonon/MediaSource>
#include <phonon/AudioOutput>
#include <phonon/Path>
#include <phonon/ObjectDescription>
#include <iostream>

// class implementing a Phonon sound player 
// using the Singleton pattern
class SoundPlayer : public QObject{

	Q_OBJECT
	
public:
	static SoundPlayer* getInstance();
	static void destroyInstance();
	
	void setPosition(qint64 position);
	void setAudiofile(QString string);
	Phonon::MediaObject* getPlayerObject(){ return mMediaObject; };

public slots:
	void play();
	void stop();
	void playStopKey();

private:
	// private constructor
	SoundPlayer();	
	~SoundPlayer();
	
	// Singleton
	static SoundPlayer* instance;
	
	// Private Members
	qint64 mPosition;
	Phonon::AudioOutput *mAudioOutput;
	Phonon::MediaObject *mMediaObject;
	
};
#endif // SOUNDPLAYER_H
